define(["jquery", "easy-admin", "treetable"], function ($, ea) {
    var table = layui.table,
        treetable = layui.treetable;
    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'mall.withdrawal/index',
        edit_url: 'mall.withdrawal/edit',
        export_url: 'mall.withdrawal/export',
        status_url: 'mall.withdrawal/status',
    };
    var Controller = {
        index: function () {
            ea.table.render({
                init: init,
                height:'full-50',
                toolbar: ['refresh',
                    [],
                    'export'],
                cols: [[
                    {type: 'checkbox'},
                    {field: 'id', title: 'id',width: 60,search:false},
                    {field: 'commission', title: '提现金额',templet: ea.table.price},
                    {field: 'title', title: '代理商'},
                    {field: 'status', title: '提现状态',selectList:{0:'待审核',1:'提现成功',2:'提现失败'}},

                    {field: 'create_time', title: '提现时间', width:170,search: 'range'},
                    {
                        width: 200,
                        title: '操作',
                        templet: ea.table.tool,
                        operat: [
                            [{
                                text: '已打款',
                                url: init.status_url+'?status=1',
                                method: 'require',
                                auth: 'edit',
                                class: 'layui-btn layui-btn-xs layui-btn-normal',
                                extend: 'data-full="true"',
                                show: [
                                    {"name": "status", "value": "0"}
                                ]
                            },{
                                text: '失败',
                                url: init.status_url+'?status=2',
                                method: 'require',
                                auth: 'edit',
                                class: 'layui-btn layui-btn-xs layui-btn-error',
                                extend: 'data-full="true"',
                                show: [
                                    {"name": "status", "value": "0"}
                                ]
                            }],
                        ]
                    }
                ]],
            });
            ea.listen();
        },
        edit:function (){
            ea.listen();
        },
        status:function (){
            ea.listen();
        }
    }
    return Controller;
});